﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>超时处理规则</title>
    <!--SQL编辑器-->
    <link href="../../Scripts/CodeMirror/lib/codemirror.css" rel="stylesheet" />
    <link href="../../Scripts/CodeMirror/addon/hint/show-hint.css" rel="stylesheet" />
    <script src="../../Scripts/CodeMirror/lib/codemirror.js"></script>
    <script src="../../Scripts/CodeMirror/addon/edit/matchbrackets.js"></script>
    <script src="../../Scripts/CodeMirror/mode/sql/sql.js"></script>
    <script src="../../Scripts/CodeMirror/addon/hint/show-hint.js"></script>
    <script src="../../Scripts/CodeMirror/addon/hint/sql-hint.js"></script>
    <script src="../../LoadSql.js"></script>

    <link href="../../Scripts/easyUI145/themes/color.css" rel="stylesheet" />
    <link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" src="../../Comm/JScript.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />

    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>
    <script src="../Admin.js"></script>
    <style>
        #Btn_Save {
            background-image: url(../../Img/Btn/Save.png) !important;
        }
    </style>

    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            $("#Msg").html("<img src='../../Img/loading.gif' />&nbsp;正在加载,请稍后......");

            var nodeID = GetQueryString("FK_Node");
            var nodeEntity = new Entity("BP.WF.Node", nodeID); //流程实体.

            var nodes = new Entities("BP.WF.Nodes"); //节点s.
            nodes.Retrieve("FK_Flow", nodeEntity.FK_Flow);

            //绑定数据源.
            GenerBindDDL("DDL_Nodes", nodes, "NodeID", "Name", nodeEntity.DoOutTime);

            if (nodeEntity.OutTimeDeal == 3) {
                //自动移交到指定的人员.
                document.getElementById("TB_Shift").value = nodeEntity.DoOutTime;
            }

            if (nodeEntity.OutTimeDeal == 4) {
                //向指定的人员发送消息.
                document.getElementById("TB_SendEmps").value = nodeEntity.DoOutTime;
            }

            if (nodeEntity.OutTimeDeal == 6) {
                //执行SQL.
                document.getElementById("TB_SQL").value = nodeEntity.DoOutTime;
            }

            //  if (nodeEntity.IsEval == 1)
            //   document.getElementById("TB_SQL").value = nodeEntity.DoOutTime;

            //调用公共类库的方法:执行批量主表赋值.
            GenerFullAllCtrlsVal(nodeEntity);

            $("#Msg").html("");

        });
    </script>
</head>
<body >

<form id="cc">
    <div id="bar" class="cs-tr cs-bar">
        <label style="float:left;font-size:15px;font-weight:bolder;padding-top:10px;">超时处理规则</label>
        <input id="Btn_Save" type="button" value="保存" onclick="Save()" />
    </div>
    <fieldset>
        <legend><input type="radio" value="0"  id="RB_OutTimeDeal_0" name="RB_OutTimeDeal" /> <label for="RB_OutTimeDeal_0">不处理 </label> </legend>
        <ul style=" color:Gray">
            <li>超时的时候一直处理超时的状态。</li>
        </ul>
    </fieldset>

    <fieldset>
        <legend><input type="radio" value="1"  id="RB_OutTimeDeal_1" name="RB_OutTimeDeal" /> <label for="RB_OutTimeDeal_1">自动向下运动 </label> </legend>

        <ul style=" color:Gray">
            <li>超时了当前节点自动运动到下一个环节，如果要控制特定的条件下不向下运动，就需要在当前节点的发送前事件里编写相关的业务逻辑。</li>
            <li>自动向下运动需要明确下一个节点的接受人，与到达的节点，所以一下两种行为不能自动向下运动。</li>
            <li>1. 当前节点的方向条件控制规则是选择的模式.</li>
            <li>2. 到达的节点的接受人规则是上一个节点选择的.</li>
        </ul>
    </fieldset>


    <fieldset>
    <legend><input type="radio" value="2"  id="RB_OutTimeDeal_2" name="RB_OutTimeDeal" /> <label for="RB_OutTimeDeal_2">跳转到指定的节点 </label> </legend>
 
        <ul style=" color:Gray">
        <li> 要跳转到的节点: <select id="DDL_Nodes" name="DDL_Nodes" > </select>
        </li>
        </ul>
    </fieldset>



    <fieldset>
    <legend><input type="radio" value="3"  id="RB_OutTimeDeal_3" name="RB_OutTimeDeal" /> <label for="RB_OutTimeDeal_3">移交给指定的人员 </label> </legend>
        <br />
         <a href="javascript:ShowHidden('shift');" > 请输入要移交的工作人员：</a>
        <br />
         <div id="shift" style="display:none">
            <ul>
                <li>接受输入的必须是人员的工作帐号。</li>
                <li>如果有多个人元用半角的逗号分开，比如: zhangsan,lisi。</li>
                <li>超时后就自动的移交给指定的工作人员。</li>
            </ul>
          </div>
      
      <input id="TB_Shift" name="TB_Shift"  type="text"  />
    </fieldset>


    <fieldset>
        <legend><input type="radio" value="4" id="RB_OutTimeDeal_4" name="RB_OutTimeDeal" /> <label for="RB_OutTimeDeal_4">给指定的人员发送消息. </label> </legend>
        <br />
        <a href="javascript:ShowHidden('emps');"> 请输入要发送的工作人员：</a>
        <br />
        <div id="emps" style="display:none">
            <ul>
                <li>接受输入的必须是人员的工作帐号。</li>
                <li>如果有多个人元用半角的逗号分开，比如: zhangsan,lisi。</li>
                <li>超时后，系统就会向这些人员发送消息。</li>
            </ul>
        </div>
        <input id="TB_SendEmps" name="TB_SendEmps" type="text" />

    </fieldset>


    <fieldset>
        <legend><input type="radio" value="5"  id="RB_OutTimeDeal_5" name="RB_OutTimeDeal" /> <label for="RB_OutTimeDeal_5">删除流程 </label> </legend>

         <ul style=" color:Gray">
            <li>超时后就自动删除当前的流程。</li>
        </ul>
    </fieldset>


    <fieldset>
        <legend><input type="radio" value="6" id="RB_OutTimeDeal_6" name="RB_OutTimeDeal" /> <label for="RB_OutTimeDeal_6">执行SQL </label> </legend>
        <br />
        <a href="javascript:ShowHidden('sql');"> 请输入要执行的SQL：</a>
        <br />
        <div id="sql" style="display:none">
            <ul>
                <li>当前的的sql支持ccbpm的表达式.比如:@WebUser.No,@WebUser.Name,@WebUser.FK_Dept,@WebUser.OrgNo</li>
                <li>执行相关的SQL，处理相关的业务逻辑。</li>
            </ul>
        </div>

        <textarea id="TB_SQL" name="TB_SQL" rows="3"> </textarea>
    </fieldset>


    <fieldset>
        <legend>其他选项 </legend>
        <br />
        <input type="checkbox" id="CB_IsEval" name="CB_IsEval" /><label for="CB_IsEval">是否质量考核点</label>
    </fieldset>


    <div style="float:right" id="Msg"> </div>


<script type="text/javascript">

    function Save() {

        $("#Msg").html("正在保存,请稍后......");

        var checked = document.getElementById("CB_IsEval").checked;
        if (checked == true)
            checked = 1;
        else
            checked = 0;

        var node = new Entity("BP.WF.Node", GetQueryString("FK_Node"));
        node.IsEval = checked; //是否是质量考核.

        //如果是无.
        if (document.getElementById("RB_OutTimeDeal_0").checked == true) {
            node.OutTimeDeal = 0;
        }


        //如果是自动运行到下一个节点.
        if (document.getElementById("RB_OutTimeDeal_1").checked == true) {
            node.OutTimeDeal = 1;
        }

        //跳转到指定的节点.
        if (document.getElementById("RB_OutTimeDeal_2").checked == true) {
            node.OutTimeDeal = 2;
            node.DoOutTime = $("#DDL_Nodes").val(); //
        }

        //移交指定的人员.
        if (document.getElementById("RB_OutTimeDeal_3").checked == true) {
            node.OutTimeDeal = 3;
            node.DoOutTime = $("#TB_Shift").val(); //
        }

        //要发送给指定的人员.
        if (document.getElementById("RB_OutTimeDeal_4").checked == true) {
            node.OutTimeDeal = 4;
            node.DoOutTime = $("#TB_SendEmps").val(); //
        }

        //删除流程.
        if (document.getElementById("RB_OutTimeDeal_5").checked == true) {
            node.OutTimeDeal = 5;
            //node.DoOutTime = $("#TB_SendEmps").val(); //
        }

        //执行sql.
        if (document.getElementById("RB_OutTimeDeal_6").checked == true) {
            node.OutTimeDeal = 6;
            node.DoOutTime = $("#TB_SQL").val(); //
        }

        node.Update(); //执行更新.
        window.location.href = window.location.href;
    }
</script>

</form>

</body>
</html>

